const app = getApp();
//根据运行环境标记,自动配置连接地址
const accountInfo = wx.getAccountInfoSync();
//版本信息
const envVersion = accountInfo.miniProgram.envVersion;
const devMenuData=[
  {
    title: '职业健康与安全管理',
    name: 'menu',
    package:"pages",
    icon:'t-icon-anquan1',
    params:""
  }
  ,
  {
    title: 'Tissue质量安全',
    name: 'tissueMenu',
    package:"pages",
    icon:'t-icon-yinhuangenzong',
    params:""
  }
  ,
  {
    title: '教学课程',
    name: 'video',
    package:"pages",
    icon:'t-icon-shipin',
    params:""
  }
  ,
  {
    title: '生产运营控制中心',
    name: 'moa',
    package:"pages",
    icon:'t-icon-peixun3',
    params:""
  }
]

const prodMenuData=[
  {
    title: '职业健康与安全管理',
    name: 'menu',
    package:"pages",
    icon:'t-icon-anquan1',
    params:""
  }
  ,
  {
    title: 'Tissue质量安全',
    name: 'tissueMenu',
    package:"pages",
    icon:'t-icon-yinhuangenzong',
    params:""
  }
  ,
  {
    title: '教学课程',
    name: 'video',
    package:"pages",
    icon:'t-icon-shipin',
    params:""
  }
  ,
  {
    title: '生产运营控制中心',
    name: 'moa',
    package:"pages",
    icon:'t-icon-peixun3',
    params:""
  }
]

Page({
  options: {
    addGlobalClass: true,
  },
  data: {
    menuData:envVersion==='release'?prodMenuData:devMenuData
  },

  gotoUrl(e){
    console.log('e',e);
    const item = e?.currentTarget?.dataset?.item
    wx.redirectTo({
      url: `/${item.package}/${item.name}/${item.name}${item.params}`,
    });
  },

  onShow(){
    //校验登录状态
    app.checkAuth()
  },
})